﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Yule8xCommon.Applib;
using Yule8xCommon.Db;

namespace Yule8xModel.PageModels
{
    public class WithDrawPageModels
    {
        public static WithDrawPageData GetPageData(int user_id)
        {
            string sqlstmt = string.Format("select s.withdraw_amount_total, a.blance from t_user_finance_account a inner join t_user_finance_statistics s on a.user_id=s.user_id where a.user_id={0}", user_id);
            DataTable dt = DbFactory.Init(AppInfo.conn_yule8x_agent).ExecuteDataTable(sqlstmt);
            if (dt.Rows.Count < 1)
            {
                return null;
            }
            WithDrawPageData pageData = new WithDrawPageData()
            {
                blance = DataTableUtil.GetDecimal(dt, "blance"),
                total_withdraw_amount = DataTableUtil.GetDecimal(dt, "withdraw_amount_total"),
            };
            return pageData;
        }
        public class WithDrawPageData
        {
            /// <summary>
            /// 累计提现余额
            /// </summary>
            public decimal total_withdraw_amount { get; set; }
            /// <summary>
            /// 可提现余额
            /// </summary>
            public decimal blance { get; set; }
        }
    }
}
